package com.qrpay.util;

/**
 * 字节数组工具类
 */
public final class BytesUtils {

    private BytesUtils() {
    }

    private static final String DIGITS = "0123456789abcdef";

    public static char[] toHex(byte[] data) {
        int l = data.length;
        char[] out = new char[l << 1];
        for (int i = 0, j = 0; i < l; i++) {
            out[j++] = DIGITS.charAt((0xF0 & data[i]) >>> 4);
            out[j++] = DIGITS.charAt(0x0F & data[i]);
        }
        return out;
    }
}
